package cn.com.joco.dk.core.user;

import org.apache.shiro.authc.UsernamePasswordToken;

public class MultiUsernamePasswordToken extends UsernamePasswordToken {
	public String module;
	public String username;
	public char[] password;
	public String host;
	public boolean rememberMe;
	public MultiUsernamePasswordToken (final String username, final char[] password,
            final boolean rememberMe,  final String module, final String host) { 
		this.module = module;
		this.username=username;
		this.password=password;
		this.rememberMe=rememberMe;
	}
	public MultiUsernamePasswordToken(String username, char[] password) {
		this(username,password,false,null,null);
	}
	public MultiUsernamePasswordToken(String username, char[] password,final boolean rememberMe) {
		this(username,password,rememberMe,null,null);
	}
	public MultiUsernamePasswordToken(String username, String password,final boolean rememberMe) {
		this(username,password!=null?password.toCharArray():null,rememberMe,null,null);
		
	}
	 public void clear() {
	        this.username = null;
	        this.host = null;
	        this.module=null;
	        this.rememberMe = false;

	        if (this.password != null) {
	            for (int i = 0; i < password.length; i++) {
	                this.password[i] = 0x00;
	            }
	            this.password = null;
	        }

	    }
	public String getModule() {
		return module;
	}
	public String getUsername() {
		return username;
	}
	public char[] getPassword() {
		return password;
	}
	public String getHost() {
		return host;
	}
	public boolean isRememberMe() {
		return rememberMe;
	}
	public void setModule(String module) {
		this.module = module;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public void setPassword(char[] password) {
		this.password = password;
	}
	public void setHost(String host) {
		this.host = host;
	}
	public void setRememberMe(boolean rememberMe) {
		this.rememberMe = rememberMe;
	}
	
	
	
	
	
}
